package cn.itcalvin.sncoal.cth.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.itcalvin.sncoal.cth.domain.LogOp;
import cn.itcalvin.sncoal.cth.utils.SnowFlakeUtils;
import org.springframework.stereotype.Service;

import cn.itcalvin.sncoal.cth.mapper.main.LogOpMapper;
import cn.itcalvin.sncoal.cth.service.LogOpService;

import javax.annotation.Resource;

@Service
public class LogOpServiceImpl implements LogOpService{

    @Resource
    private LogOpMapper logOpMapper;

    /**
     * 新增日志
     *
     * @param opType
     * @param businessId
     * @return
     */
    @Override
    public boolean addLog(Integer opType,Long businessId,Long userId) {
        return logOpMapper.insert(new LogOp(){{
            setId(SnowFlakeUtils.getId());
            setOpType(opType);
            setBusinessId(businessId);
            setUserId(userId);
            setCreateTime(DateUtil.date());
        }})>0;
    }
}
